<include file="public@header"/>
<style>html{background-color: #ffffff}</style>
</head>
<body>
<div class="layui-row layui-tab">
    <div class="layui-side" style="background: #f5f7f9;">
        <ul class="layui-if-menu" id="tabHeader">
            <li class="layui-this"><i class="icon-icon layui-icon-md-settings"></i>基本属性</li>
            <!-- <li><i class="icon-icon layui-icon-md-code-working"></i>SEO设置</li>
            <li><i class="icon-icon layui-icon-ios-color-palette"></i>模板设置</li> -->
        </ul>
    </div>
    <div class="layui-body" style="padding: 15px 25px 0 15px;">
        <div class="layui-tab-item layui-show">
	        <form class="layui-form js-ajax-form" action="{:url('AdminCategory/editPost')}" method="post">
	            <div id="tabBody">
	                <div class="layui-tab-item layui-show">
	                    <div class="layui-form-item">
	                        <label class="layui-form-label" for="input-parent"><span class="form-required">*</span>上级</label>
	                        <div class="layui-input-block">
	                            <select class="layui-input" name="parent_id" id="input-parent">
	                                <option value="0">作为一级分类</option>
	                                {$categories_tree}
	                            </select>
	                        </div>
	                    </div>
	                    <div class="layui-form-item">
	                        <label class="layui-form-label" for="input-name"><span class="form-required">*</span>分类名称</label>
	                        <div class="layui-input-block">
	                            <input type="text" class="layui-input" id="input-name" name="name" value="{$name}">
	                        </div>
	                    </div>
	                    <div class="layui-form-item">
	                        <label class="layui-form-label" for="input-name">分类别名</label>
	                        <div class="layui-input-block">
	                            <input type="text" class="layui-input" id="input-alias" name="alias"
	                                   value="{$alias|default=''}">
	                        </div>
	                    </div>
	                    <div class="layui-form-item">
	                        <label class="layui-form-label" for="input-description">描述</label>
	                        <div class="layui-input-block">
	                                <textarea class="layui-textarea" name="description"
	                                          id="input-description">{$description}</textarea>
	                        </div>
	                    </div>
	                    <php>
							$status_yes=$category['home_recommended']==1?"checked":"";
						</php>
						<div class="layui-form-item">
							<label class="layui-form-label" for="input-description">首页推荐</label>
							<div class="layui-input-block" style="padding-top:9px;">
								<label class="lyear-checkbox checkbox-info">
									<input type="checkbox" id="home_recommended-checkbox" name="home_recommended" value="1" lay-ignore {$status_yes}>推荐
									<span></span>
								</label>
								<span id="recommended-error" style="color: red;display: none"></span>
							</div>
						</div>
	                    <div class="layui-form-item">
	                        <label class="layui-form-label" for="input-description">缩略图</label>
	                        <div class="layui-input-block">
	                            <input type="hidden" name="more[thumbnail]" class="form-control"
	                                   value="{$more.thumbnail|default=''}" id="js-thumbnail-input">
	                            <div>
	                                <a href="javascript:uploadOneImage('图片上传','#js-thumbnail-input');">
	                                    <if condition="empty($more.thumbnail)">
	                                        <img src="__TMPL__/public/assets/images/default-thumbnail.png"
	                                             id="js-thumbnail-input-preview"
	                                             width="135" style="cursor: pointer"/>
	                                        <else/>
	                                        <img src="{:cmf_get_image_preview_url($more.thumbnail)}"
	                                             id="js-thumbnail-input-preview"
	                                             width="135" style="cursor: pointer"/>
	                                    </if>
	                                </a>
	                            </div>
	                        </div>
	                    </div>
	                </div>
	                <div class="layui-tab-item">
	                    <div class="layui-form-item">
	                        <label class="layui-form-label" for="input-seo_title">SEO标题</label>
	                        <div class="layui-input-block">
	                            <input type="text" class="layui-input" id="input-seo_title" name="seo_title"
	                                   value="{$seo_title}">
	                        </div>
	                    </div>
	                    <div class="layui-form-item">
	                        <label class="layui-form-label" for="input-seo_keywords">SEO关键字</label>
	                        <div class="layui-input-block">
	                            <input type="text" class="layui-input" id="input-seo_keywords" name="seo_keywords"
	                                   value="{$seo_keywords}">
	                        </div>
	                    </div>
	                    <div class="layui-form-item">
	                        <label class="layui-form-label" for="input-seo_description">SEO描述</label>
	                        <div class="layui-input-block">
	                            <textarea class="layui-textarea" name="seo_description" id="input-seo_description">{$seo_description}</textarea>
	                        </div>
	                    </div>
	                </div>
	                <div class="layui-tab-item">
	                    <div class="layui-form-item">
	                        <label class="layui-form-label" for="input-list_tpl"><span class="form-required">*</span>列表模板</label>
	                        <div class="layui-input-block">
	                            <select class="layui-input" name="list_tpl" id="input-list_tpl">
	                                <!--<option value="list">portal/list.html(默认)</option>-->
	                                <foreach name="list_theme_files" item="vo">
	                                    <php>$value=preg_replace('/^portal\//','',$vo['file']);</php>
	                                    <option value="{$value}">{$vo.name} {$vo.file}.html</option>
	                                </foreach>
	                            </select>
	                        </div>
	                    </div>
	                    <div class="layui-form-item">
	                        <label class="layui-form-label" for="input-one_tpl"><span class="form-required">*</span>文章模板</label>
	                        <div class="layui-input-block">
	                            <select class="layui-input" name="one_tpl" id="input-one_tpl">
	                                <!--<option value="article">portal/article.html(默认)</option>-->
	                                <foreach name="article_theme_files" item="vo">
	                                    <php>$value=preg_replace('/^portal\//','',$vo['file']);</php>
	                                    <option value="{$value}">{$vo.name} {$vo.file}.html</option>
	                                </foreach>
	                            </select>
	                        </div>
	                    </div>
	                </div>
	                <div class="layui-form-item">
	                    <div class="layui-input-block">
	                        <input type="hidden" name="id" value="{$id}">
	                        <button type="submit" class="layui-btn js-ajax-submit" data-refresh="0">{:lang('SAVE')}</button>
	                    </div>
	                </div>
	            </div>
	        </form>
		</div>
	</div>
</div>
<include file="public@script"/>
<script>
    $('#input-list_tpl').val("{$list_tpl|default=''}");
    $('#input-one_tpl').val("{$one_tpl|default=''}");
</script>
<script>
    //注意：选项卡 依赖 element 模块，否则无法进行功能性操作
    layui.use('element', function(){
        var element = layui.element;

        //JavaScript
        element.tab({
            headerElem: '#tabHeader>li' //指定tab头元素项
            ,bodyElem: '#tabBody>.layui-tab-item' //指定tab主体元素项
        });
    });
</script>
</body>
</html>